Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FFmpeg/FFmpeg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: afdfff485b65
Choose a base ref
...
head repository: FFmpeg/FFmpeg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a2f7314ba231
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 25, 2013

  1. yop: Fix return type

    Found-by: durandal_1707
    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    michaelni committed Mar 25, 2013
    Copy the full SHA
    8097e5b View commit details
  2. xxan: make code independent of sizeof(AVFrame)

    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    michaelni committed Mar 25, 2013
    Copy the full SHA
    67607e2 View commit details
  3. libpostproc: silence valgrind/fate warning about using uninitialized …

    …data
    
    Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
    michaelni committed Mar 25, 2013
    Copy the full SHA
    a2f7314 View commit details
Showing with 37 additions and 25 deletions.
  1. +31 −23 libavcodec/xxan.c
  2. +3 −1 libavcodec/yop.c
  3. +3 −1 libpostproc/postprocess_template.c
54 changes: 31 additions & 23 deletions libavcodec/xxan.c
Original file line number Diff line number Diff line change
@@ -30,14 +30,16 @@

typedef struct XanContext {
AVCodecContext *avctx;
AVFrame pic;
AVFrame *pic;

uint8_t *y_buffer;
uint8_t *scratch_buffer;
int buffer_size;
GetByteContext gb;
} XanContext;

static av_cold int xan_decode_end(AVCodecContext *avctx);

static av_cold int xan_decode_init(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;
@@ -57,7 +59,13 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
s->scratch_buffer = av_malloc(s->buffer_size + 130);
if (!s->scratch_buffer) {
av_freep(&s->y_buffer);
xan_decode_end(avctx);
return AVERROR(ENOMEM);
}

s->pic = av_frame_alloc();
if (!s->pic) {
xan_decode_end(avctx);
return AVERROR(ENOMEM);
}

@@ -195,8 +203,8 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
return dec_size;
}

U = s->pic.data[1];
V = s->pic.data[2];
U = s->pic->data[1];
V = s->pic->data[2];
src = s->scratch_buffer;
src_end = src + dec_size;
if (mode) {
@@ -215,16 +223,16 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
V[i] = vval | (vval >> 5);
}
}
U += s->pic.linesize[1];
V += s->pic.linesize[2];
U += s->pic->linesize[1];
V += s->pic->linesize[2];
}
if (avctx->height & 1) {
memcpy(U, U - s->pic.linesize[1], avctx->width >> 1);
memcpy(V, V - s->pic.linesize[2], avctx->width >> 1);
memcpy(U, U - s->pic->linesize[1], avctx->width >> 1);
memcpy(V, V - s->pic->linesize[2], avctx->width >> 1);
}
} else {
uint8_t *U2 = U + s->pic.linesize[1];
uint8_t *V2 = V + s->pic.linesize[2];
uint8_t *U2 = U + s->pic->linesize[1];
uint8_t *V2 = V + s->pic->linesize[2];

for (j = 0; j < avctx->height >> 2; j++) {
for (i = 0; i < avctx->width >> 1; i += 2) {
@@ -241,16 +249,16 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
V[i] = V[i+1] = V2[i] = V2[i+1] = vval | (vval >> 5);
}
}
U += s->pic.linesize[1] * 2;
V += s->pic.linesize[2] * 2;
U2 += s->pic.linesize[1] * 2;
V2 += s->pic.linesize[2] * 2;
U += s->pic->linesize[1] * 2;
V += s->pic->linesize[2] * 2;
U2 += s->pic->linesize[1] * 2;
V2 += s->pic->linesize[2] * 2;
}
if (avctx->height & 3) {
int lines = ((avctx->height + 1) >> 1) - (avctx->height >> 2) * 2;

memcpy(U, U - lines * s->pic.linesize[1], lines * s->pic.linesize[1]);
memcpy(V, V - lines * s->pic.linesize[2], lines * s->pic.linesize[2]);
memcpy(U, U - lines * s->pic->linesize[1], lines * s->pic->linesize[1]);
memcpy(V, V - lines * s->pic->linesize[2], lines * s->pic->linesize[2]);
}
}

@@ -327,12 +335,12 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
}

src = s->y_buffer;
ybuf = s->pic.data[0];
ybuf = s->pic->data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
ybuf[i] = (src[i] << 2) | (src[i] >> 3);
src += avctx->width;
ybuf += s->pic.linesize[0];
ybuf += s->pic->linesize[0];
}

return 0;
@@ -373,12 +381,12 @@ static int xan_decode_frame_type1(AVCodecContext *avctx)
}

src = s->y_buffer;
ybuf = s->pic.data[0];
ybuf = s->pic->data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
ybuf[i] = (src[i] << 2) | (src[i] >> 3);
src += avctx->width;
ybuf += s->pic.linesize[0];
ybuf += s->pic->linesize[0];
}

return 0;
@@ -392,7 +400,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
int ftype;
int ret;

if ((ret = ff_reget_buffer(avctx, &s->pic)) < 0)
if ((ret = ff_reget_buffer(avctx, s->pic)) < 0)
return ret;

bytestream2_init(&s->gb, avpkt->data, avpkt->size);
@@ -411,7 +419,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
if (ret)
return ret;

if ((ret = av_frame_ref(data, &s->pic)) < 0)
if ((ret = av_frame_ref(data, s->pic)) < 0)
return ret;

*got_frame = 1;
@@ -423,7 +431,7 @@ static av_cold int xan_decode_end(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;

av_frame_unref(&s->pic);
av_frame_free(&s->pic);

av_freep(&s->y_buffer);
av_freep(&s->scratch_buffer);
4 changes: 3 additions & 1 deletion libavcodec/yop.c
Original file line number Diff line number Diff line change
@@ -79,11 +79,13 @@ static const int8_t motion_vector[16][2] =
{ 4, -2}, {-2, 0},
};

static av_cold void yop_decode_close(AVCodecContext *avctx)
static av_cold int yop_decode_close(AVCodecContext *avctx)
{
YopDecContext *s = avctx->priv_data;

av_frame_free(&s->frame);

return 0;
}

static av_cold int yop_decode_init(AVCodecContext *avctx)
4 changes: 3 additions & 1 deletion libpostproc/postprocess_template.c
Original file line number Diff line number Diff line change
@@ -3216,17 +3216,19 @@ static inline void RENAME(duplicate)(uint8_t src[], int stride)
#if TEMPLATE_PP_MMX
__asm__ volatile(
"movq (%0), %%mm0 \n\t"
"movq %%mm0, (%0, %1, 4) \n\t"
"add %1, %0 \n\t"
"movq %%mm0, (%0) \n\t"
"movq %%mm0, (%0, %1) \n\t"
"movq %%mm0, (%0, %1, 2) \n\t"
"movq %%mm0, (%0, %1, 4) \n\t"
: "+r" (src)
: "r" ((x86_reg)-stride)
);
#else
int i;
uint8_t *p=src;
for(i=0; i<3; i++){
for(i=0; i<5; i++){
p-= stride;
memcpy(p, src, 8);
}